from blackjack import BlackjackEnv
from qlearning_agent import QLearningAgent

# 创建环境和代理
env = BlackjackEnv()
state_dim = 3
action_dim = 2 
agent = QLearningAgent(state_dim, action_dim)

# 加载训练好的模型权重 ？？？
#agent.q_function.load_weights("weights.h5")

# 测试代理
num_episodes = 100
for episode in range(num_episodes):
    state = env.reset()
    done = False
    total_reward = 0

    while not done:
        action = agent.get_action(state)
        next_state, reward, done, _ = env.step(action)
        total_reward += reward
        state = next_state

    print(f"Episode {episode+1}: Total Reward = {total_reward}")
